<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>源产地管理 - 编辑源产地</h3>
                <h5>网站系统源产地管理</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" id="originForm" action="{:U('Admin/origin_info')}" method="post">
        <input type="hidden" name="act" value="{$act}">
        <if !empty($origin)><input type="hidden" name="id" value="{$origin.id}"></if>
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label for="origin_name"><em>*</em>源产地名称</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="title" value="{$origin.title}" id="origin_name" class="input-txt">
                    <span class="err"></span>
                    <p class="notic">源产地名称</p>
                </dd>
            </dl>
            <dl class="row">
            	<dt class="tit">
            		<label for="type"><em>*</em>类型</label>
            	</dt>
            	<dd class="opt">
            		<select name="type" id="type">
	                	<option value="0" <if condition="$origin[type] eq 0"> selected="selected"</if> >酒</option>
                        <option value="1" <if condition="$origin[type] eq 1"> selected="selected"</if> >茶</option>
	                </select>
            	</dd>
            </dl>
            <dl class="row">
		        <dt class="tit">源产地缩略图片</dt>
		        <dd class="opt">
		          <div class="input-file-show" id="divComUploadContainer">
		            <span class="show">
		                <a class="nyroModal" rel="gal" href="{$origin.thumbnail}">
		                    <i class="fa fa-picture-o" onmouseover="layer.tips('<img src={$origin.thumbnail}>',this, {tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
		                </a>
		            </span>           
		            <span class="type-file-box">            
		            <input type="text" id="imagetext" name="thumbnail" value="{$origin.thumbnail}" class="type-file-text">            
		            <input type="button" class="type-file-button" onClick="GetUploadify(1,'imagetext','category','')" value="上传图片" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效"/> 
		            </span>
		          </div>
		          <div id="thumbnails" class="ncap-thumb-list">
		            <h5><i class="fa fa-exclamation-circle"></i> 请上传图片格式文件。</h5>
		            <ul>
		            </ul>
		          </div>
		        </dd>
		    </dl> 
            <div class="bot"><a href="JavaScript:void(0);" onclick="adsubmit()" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
        </div>
    </form>
</div>
<script type="text/javascript">
    function adsubmit(){
        if($('input[name=title]').val() == ''){
            layer.msg('名称', {icon: 2,time: 1000});   //alert('少年，用户名不能为空！');
            return false;
        }
        //$("#originForm").submit();
        $.ajax({
			type: 'post',
			url: "{:U('Admin/origin_info')}",
			data : $("#originForm").serialize(),
			dataType: 'json',
			success: function (data) {
				if (data.status == 1) {
					layer.alert('操作成功', {icon: 1});
					location.href = data.data.url;
				} else {
					layer.alert('操作失败', {icon: 2});  //alert('删除失败');
				}
			}
		})
    }
</script>
</body>
